// Copyright (c) 2007, Brian Duff
// See LICENSE for license details.

package org.dubh.orablogs.ag;

import java.io.Serializable;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@NamedQueries({

@NamedQuery(name = "BlogEntries.findAll",
  query = "select o from BlogEntry o"),
              
@NamedQuery(name = "BlogEntries.findEntryByGuid",
  query = "select o from BlogEntry o where o.guid = :guid and o.bloggerId = :bloggerId")
})

@Table(name = "blog_entries")
public class BlogEntry
  implements Serializable
{
  @ManyToOne
  @JoinColumn(name="blogger_id", nullable = false)
  private Blog blogger;
  @Column(name="body", nullable = false)
  private String body;
  @Column(name="entry_date")
  private Timestamp entry_date;
  @Column(name="gathered_date")
  private Timestamp gathered_date;
  @Id
  @Column(name="guid", nullable = false)
  private String guid;
  @Column(name="link", nullable = false)
  private String link;
  @Column(name="title")
  private String title;
  
  @Column(name="blogger_id", nullable = false, insertable = false, updatable = false)
  private Integer bloggerId;

  public BlogEntry()
  {
  }

  public Blog getBlogger()
  {
    return blogger;
  }

  public void setBlogger(Blog blog)
  {
    this.blogger = blog;
  }

  public String getBody()
  {
    return body;
  }

  public void setBody(String body)
  {
    this.body = body;
  }

  public Timestamp getEntryDate()
  {
    return entry_date;
  }

  public void setEntryDate(Timestamp entry_date)
  {
    this.entry_date = entry_date;
  }

  public Timestamp getGatheredDate()
  {
    return gathered_date;
  }

  public void setGatheredDate(Timestamp gathered_date)
  {
    this.gathered_date = gathered_date;
  }

  public String getGuid()
  {
    return guid;
  }

  public void setGuid(String guid)
  {
    this.guid = guid;
  }

  public String getLink()
  {
    return link;
  }

  public void setLink(String link)
  {
    this.link = link;
  }

  public String getTitle()
  {
    return title;
  }

  public void setTitle(String title)
  {
    this.title = title;
  }
}
